package com.cheeven.cwliu.citation.steps;

import java.io.FileReader;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Properties;

public class Step0 extends StepBase {

	public static void loadApplicationParameters(HashMap<String, String> control) {
		try {
			logInfo("0. Load application parameters");
			
			Properties prop = new Properties();
			prop.load(new FileReader("configuration.txt"));
			
			Enumeration pe = prop.propertyNames();
			while(pe.hasMoreElements()) {
				String key = (String) pe.nextElement();
				String value = prop.getProperty(key);
				
				control.put(getAppPrefix() + "." + key, value);
			}		
			
			logInfo(1, "Application Parameters: {0}", control);
		} catch (Exception ex) {
			logError(ex);
			throw new RuntimeException(ex);
		}

	}
}
